package com.whsr.readservice.dao;

import com.whsr.readservice.vo.AttachMent;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.springframework.stereotype.Repository;

@Repository
public interface AttachMentMapper {


    @Insert("insert into attachment (id, content, create_time, type, is_use) values (#{id}, #{content, typeHandler=org.apache.ibatis.type.BlobTypeHandler}, #{createTime}, #{type}, #{isUse})")
    @SelectKey(statement="SELECT LAST_INSERT_ID()",keyProperty="id",before=false,resultType=Integer.class)
    void saveImage(AttachMent attachMent);

    @Select("select * from attachment where id=#{id}")
    AttachMent getImgById(int id);
}
